import { Button, Col, Form, Input, Row, Select, Space, InputNumber, Cascader, DatePicker } from 'antd';
import React from 'react';

interface CompanyFormProps {
  form: any;
}

const { Option } = Select;

// Mock data for select options
const mockOptions = {
  enterpriseCategory: [{ value: '1', label: '国有企业' }, { value: '2', label: '集体企业' }, { value: '3', label: '私营企业' }],
  unitNature: [{ value: '1', label: '机关' }, { value: '2', label: '事业单位' }, { value: '3', label: '企业' }],
  businessUnit: [{ value: 'Y', label: '是' }, { value: 'N', label: '否' }],
  administrativeAffiliation: [{ value: '1', label: '中央' }, { value: '2', label: '省' }, { value: '3', label: '市' }],
  departmentId: [{ value: '1', label: '财政部' }, { value: '2', label: '教育部' }],
  countryCode: [{ value: 'CHN', label: '中国' }, { value: 'USA', label: '美国' }],
  regionCode: [{ value: '110000', label: '北京市' }, { value: '310000', label: '上海市' }],
  cascaderOptions: [
    {
      value: '110000',
      label: '北京市',
      children: [
        {
          value: '110100',
          label: '市辖区',
          children: [
            {
              value: '110101',
              label: '东城区',
            },
          ],
        },
      ],
    },
  ],
  industryClassification: [{ value: 'A', label: '农、林、牧、渔业' }, { value: 'B', label: '采矿业' }],
  accountingStandards: [{ value: '1', label: '企业会计准则' }, { value: '2', label: '小企业会计准则' }],
  enterpriseScale: [{ value: '1', label: '大型' }, { value: '2', label: '中型' }, { value: '3', label: '小型' }],
  economicType: [{ value: '1', label: '国有经济' }, { value: '2', label: '集体经济' }],
  jointVenture: [{ value: '1', label: '中外合资' }, { value: '2', label: '中外合作' }],
  organizationForm: [{ value: '1', label: '有限责任公司' }, { value: '2', label: '股份有限公司' }],
  newFinancialInstruments: [{ value: 'Y', label: '是' }, { value: 'N', label: '否' }],
  mixedOwnership: [{ value: 'Y', label: '是' }, { value: 'N', label: '否' }],
  employeeStockOwnership: [{ value: 'Y', label: '是' }, { value: 'N', label: '否' }],
  stockCategory: [{ value: 'A', label: 'A股' }, { value: 'B', label: 'B股' }, { value: 'H', label: 'H股' }],
  auditMethod: [{ value: '1', label: '现场审计' }, { value: '2', label: '远程审计' }],
  auditOpinionType: [{ value: '1', label: '标准无保留意见' }, { value: '2', label: '带强调事项段的无保留意见' }],
  reportingFactors: [{ value: '1', label: '例行上报' }, { value: '2', label: '专项上报' }],
  reportType: [{ value: '1', label: '单户报表' }, { value: '2', label: '合并报表' }],
  includedInBudget: [{ value: 'Y', label: '是' }, { value: 'N', label: '否' }],
  stateCapitalGains: [{ value: '1', label: '利润上交' }, { value: '2', label: '股利分红' }],
  culturalEnterprise: [{ value: 'Y', label: '是' }, { value: 'N', label: '否' }],
};


export const CompanyForm: React.FC<CompanyFormProps> = ({ form }) => {
  return (
    <Form form={form} layout="vertical" size="small" style={{ padding: '0 16px' }}>
      <h3 style={{ fontWeight: 'bold', marginTop: '16px' }}>基本信息</h3>
      <Row gutter={16}>
        <Col span={8}>
          <Form.Item label="企业类别" name="enterpriseCategory">
            <Select options={mockOptions.enterpriseCategory} />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="单位性质" name="unitNature">
            <Select options={mockOptions.unitNature} />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="经营性单位" name="businessUnit">
            <Select options={mockOptions.businessUnit} />
          </Form.Item>
        </Col>
      </Row>
      <Row gutter={16}>
        <Col span={24}>
          <Form.Item label="企业名称" name="enterpriseName">
            <Input />
          </Form.Item>
        </Col>
      </Row>
      <Row gutter={16}>
        <Col span={8}>
          <Form.Item label="单位负责人" name="unitHead">
            <Input />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="主管会计工作负责人（总会计师）" name="chiefAccountant">
            <Input />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="会计（财务）机构负责人" name="financeDeptHead">
            <Input />
          </Form.Item>
        </Col>
      </Row>
      <Row gutter={16}>
        <Col span={8}>
          <Form.Item label="填表人" name="formFiller">
            <Input />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="邮政编码" name="postalCode">
            <Input />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="通讯地址" name="address">
            <Input />
          </Form.Item>
        </Col>
      </Row>
      <Row gutter={16}>
         <Col span={16}>
            <Form.Item label="电话号码">
                <Input.Group compact>
                    <Form.Item name={['phone', 'country']} noStyle>
                        <Input style={{ width: '20%' }} placeholder="国家和地区区号" />
                    </Form.Item>
                    <Form.Item name={['phone', 'area']} noStyle>
                        <Input style={{ width: '20%' }} placeholder="区号" />
                    </Form.Item>
                    <Form.Item name={['phone', 'number']} noStyle>
                        <Input style={{ width: '40%' }} placeholder="电话号码" />
                    </Form.Item>
                    <Form.Item name={['phone', 'ext']} noStyle>
                        <Input style={{ width: '20%' }} placeholder="分机号" />
                    </Form.Item>
                </Input.Group>
            </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="手机号码" name="mobile">
            <Input />
          </Form.Item>
        </Col>
      </Row>

      <h3 style={{ fontWeight: 'bold', marginTop: '16px' }}>审计信息</h3>
      <Row gutter={16}>
        <Col span={8}>
          <Form.Item label="报表审计机构" name="auditFirm">
            <Select showSearch options={[{value: '1', label: '普华永道中天会计师事务所'}]} />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="审计报告签字人" name="signingAuditor">
            <Input />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="本企业代码" name="enterpriseCode">
            <Input />
          </Form.Item>
        </Col>
      </Row>
      <Row gutter={16}>
        <Col span={8}>
          <Form.Item label="上一级单位（单位）代码" name="parentUnitCode">
            <Input />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="集团企业（公司）总部代码" name="hqCode">
            <Input />
          </Form.Item>
        </Col>
      </Row>

      <h3 style={{ fontWeight: 'bold', marginTop: '16px' }}>行政隶属与组织代码</h3>
      <Row gutter={16}>
        <Col span={12}>
            <Form.Item label="行政隶属关系代码">
                <Input.Group compact>
                    <Form.Item name="adminAffiliationCode" noStyle>
                        <Input style={{ width: '50%' }} />
                    </Form.Item>
                    <Form.Item name="adminAffiliationName" noStyle>
                        <Select style={{ width: '50%' }} options={mockOptions.administrativeAffiliation} />
                    </Form.Item>
                </Input.Group>
            </Form.Item>
        </Col>
        <Col span={12}>
            <Form.Item label="部门识别码">
                <Input.Group compact>
                    <Form.Item name="deptIdCode" noStyle>
                        <Input style={{ width: '50%' }} />
                    </Form.Item>
                    <Form.Item name="deptIdName" noStyle>
                        <Select style={{ width: '50%' }} options={mockOptions.departmentId} />
                    </Form.Item>
                </Input.Group>
            </Form.Item>
        </Col>
      </Row>
       <Row gutter={16}>
        <Col span={12}>
            <Form.Item label="国家代码">
                <Input.Group compact>
                    <Form.Item name="countryCode" noStyle>
                        <Input style={{ width: '50%' }} />
                    </Form.Item>
                    <Form.Item name="countryName" noStyle>
                        <Select style={{ width: '50%' }} options={mockOptions.countryCode} />
                    </Form.Item>
                </Input.Group>
            </Form.Item>
        </Col>
        <Col span={12}>
            <Form.Item label="行政区划码">
                <Input.Group compact>
                    <Form.Item name="regionCode" noStyle>
                        <Input style={{ width: '50%' }} />
                    </Form.Item>
                    <Form.Item name="regionName" noStyle>
                        <Select style={{ width: '50%' }} options={mockOptions.regionCode} />
                    </Form.Item>
                </Input.Group>
            </Form.Item>
        </Col>
      </Row>
      <Row>
        <Col span={24}>
            <Form.Item name="regionCascader">
                <Cascader options={mockOptions.cascaderOptions} />
            </Form.Item>
        </Col>
      </Row>

      <h3 style={{ fontWeight: 'bold', marginTop: '16px' }}>企业性质</h3>
      <Row gutter={16}>
        <Col span={12}>
            <Form.Item label="国民经济行业分类代码">
                <Input.Group compact>
                    <Form.Item name="industryClassCode" noStyle>
                        <Input style={{ width: '50%' }} />
                    </Form.Item>
                    <Form.Item name="industryClassName" noStyle>
                        <Select style={{ width: '50%' }} options={mockOptions.industryClassification} />
                    </Form.Item>
                </Input.Group>
            </Form.Item>
        </Col>
        <Col span={12}>
            <Form.Item label="执行会计准则代码">
                <Input.Group compact>
                    <Form.Item name="accountingStandardCode" noStyle>
                        <Input style={{ width: '50%' }} />
                    </Form.Item>
                    <Form.Item name="accountingStandardName" noStyle>
                        <Select style={{ width: '50%' }} options={mockOptions.accountingStandards} />
                    </Form.Item>
                </Input.Group>
            </Form.Item>
        </Col>
      </Row>
      <Row gutter={16}>
        <Col span={8}>
          <Form.Item label="企业规模" name="enterpriseScale">
            <Select options={mockOptions.enterpriseScale} />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="经济类型" name="economicType">
            <Select options={mockOptions.economicType} />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="中外合资合作企业" name="jointVenture">
            <Select options={mockOptions.jointVenture} />
          </Form.Item>
        </Col>
      </Row>
      <Row gutter={16}>
        <Col span={8}>
          <Form.Item label="组织形式" name="organizationForm">
            <Select options={mockOptions.organizationForm} />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="执行新金融工具准则" name="newFinancialInstruments">
            <Select options={mockOptions.newFinancialInstruments} />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="混合所有制企业" name="mixedOwnership">
            <Select options={mockOptions.mixedOwnership} />
          </Form.Item>
        </Col>
      </Row>
      <Row gutter={16}>
        <Col span={8}>
          <Form.Item label="员工持股企业" name="employeeStockOwnership">
            <Select options={mockOptions.employeeStockOwnership} />
          </Form.Item>
        </Col>
      </Row>

      <h3 style={{ fontWeight: 'bold', marginTop: '16px' }}>股权与审计方式</h3>
      <Row gutter={16}>
        <Col span={8}>
          <Form.Item label="股票类别" name="stockCategory">
            <Select mode="multiple" options={mockOptions.stockCategory} />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="股票代码" name="stockCode">
            <Input />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="备注" name="remarks">
            <Input />
          </Form.Item>
        </Col>
      </Row>
      <Row gutter={16}>
        <Col span={8}>
          <Form.Item label="审计方式" name="auditMethod">
            <Select options={mockOptions.auditMethod} />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="审计意见类型" name="auditOpinionType">
            <Select options={mockOptions.auditOpinionType} />
          </Form.Item>
        </Col>
      </Row>

      <h3 style={{ fontWeight: 'bold', marginTop: '16px' }}>其他信息</h3>
      <Row gutter={16}>
        <Col span={8}>
          <Form.Item label="设立年份" name="establishmentYear">
            <DatePicker picker="year" style={{ width: '100%' }} />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="上年企业代码" name="lastYearEnterpriseCode">
            <Input />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="上报因素" name="reportingFactors">
            <Select options={mockOptions.reportingFactors} />
          </Form.Item>
        </Col>
      </Row>
      <Row gutter={16}>
        <Col span={8}>
          <Form.Item label="报表类型码" name="reportType">
            <Select options={mockOptions.reportType} />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="是否纳入国有资本经营预算" name="includedInBudget">
            <Select options={mockOptions.includedInBudget} />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="上交国有资本收益类别" name="stateCapitalGains">
            <Select options={mockOptions.stateCapitalGains} />
          </Form.Item>
        </Col>
      </Row>
      <Row gutter={16}>
        <Col span={8}>
          <Form.Item label="文化企业" name="culturalEnterprise">
            <Select options={mockOptions.culturalEnterprise} />
          </Form.Item>
        </Col>
        <Col span={8}>
          <Form.Item label="备用码" name="backupCode">
            <Input />
          </Form.Item>
        </Col>
      </Row>

      <Form.Item wrapperCol={{ offset: 0, span: 24 }} style={{ textAlign: 'right', marginTop: '16px' }}>
        <Space>
          <Button type="primary" htmlType="submit">
            保存
          </Button>
          <Button>重置</Button>
        </Space>
      </Form.Item>
    </Form>
  );
};
